import { useLocation } from "react-router-dom";
import Error from "@/components/custom-ui/error";
import { useTranslation } from "react-i18next";

export default function CasError() {
  const { t } = useTranslation();
  const location = useLocation();
  
  // 从state参数获取错误信息
  const state = location.state as { code?: number; message?: string } || {};
  const errorCode = state.code || 500;
  const errorMessage = state.message || t("An unexpected error occurred");

  return <Error statusCode={errorCode} message={errorMessage} />;
}
